]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Exclude hidden children from the layout
authorMaxim Ermilov <zaspire@rambler.ru>
Sat, 18 Dec 2010 19:09:58 +0000 (22:09 +0300)
committerMaxim Ermilov <zaspire@rambler.ru>
Sat, 18 Dec 2010 19:23:38 +0000 (22:23 +0300)
As all children were considered for the grid's layout, hidden items showed up as
empty space. Instead, exclude hidden children from the layout, so that the grid is
only made up of visible items.

https://bugzilla.gnome.org/show_bug.cgi?id=631537

js/ui/iconGrid.js

index ff6a60b973098b5a3988f7c8d84cb44699a4f73b..e8ac3aca16fdc59774abc4957208ebe4e6d75ae4 100644 (file)
@@ -165,8 +165,16 @@ IconGrid.prototype = {
         alloc.natural_size = nColumns * this._item_size + totalSpacing;
     },
 
-    _getPreferredHeight: function (grid, forWidth, alloc) {
+    _getVisibleChildren: function() {
         let children = this._grid.get_children();
+        children = children.filter(function(actor) {
+            return actor.visible;
+        });
+        return children;
+    },
+
+    _getPreferredHeight: function (grid, forWidth, alloc) {
+        let children = this._getVisibleChildren();
         let [nColumns, usedWidth] = this._computeLayout(forWidth);
         let nRows;
         if (nColumns > 0)
@@ -182,7 +190,7 @@ IconGrid.prototype = {
     },
 
     _allocate: function (grid, box, flags) {
-        let children = this._grid.get_children();
+        let children = this._getVisibleChildren();
         let availWidth = box.x2 - box.x1;
         let availHeight = box.y2 - box.y1;